# include "VertexShaderBindAble.h"
# include "d3d11.h"
# include <iterator>
# include "VertexShader.h"

VertexShaderBindAble::VertexShaderBindAble(ID3D11Device* _device)
{
	D3D11_INPUT_ELEMENT_DESC ied[] = {
		{"POSITION", 0, DXGI_FORMAT::DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
		{"TEXCOORD", 0, DXGI_FORMAT::DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}
	};
	_device->CreateInputLayout(ied, std::size(ied), g_main_VS, sizeof(g_main_VS), this->m_inputLayout.GetAddressOf());
	_device->CreateVertexShader(g_main_VS, sizeof(g_main_VS), nullptr, this->m_vertexShader.GetAddressOf());
}

void VertexShaderBindAble::bind(ID3D11DeviceContext* _context)
{
	_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY::D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	_context->IASetInputLayout(this->m_inputLayout.Get());
	_context->VSSetShader(this->m_vertexShader.Get(), 0, 0);
}

VertexShaderBindAble::~VertexShaderBindAble()
{

}
